package com.example.demoresilience4jfeignconsumer;

import feign.FeignException;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;
public class FeignFallBack implements DemoResilience4jFeignConsumerApplication.UserloginService {
    private Exception cause;

    public FeignFallBack(Exception cause) {
        this.cause = cause;
    }

    @Override
    public Map myUserlogin(){
        HashMap<String, String> map = new HashMap<>();
        if (cause instanceof FeignException) {
            map.put("error Resilience4j-Feign call", "Feign Exception:服务器繁忙");
        } else {
            map.put("error Resilience4j-Feign call", "Other exception:服务器繁忙");
        }
        return map;
    }
}
